UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WeShABgcrTPNqwj6KUy8xNBrGmhjX7B9qpQnF8v/PhU=' 
WHERE 
  key_id = '3719cc81e8108ffb840645403323e2df350e323b7db392c7f2f08b001caaa61f' 
  AND (
    token = 'WeShABgcrTPNqwj6KUy8xNBrGmhjX7B9qpQnF8v/PhU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023