UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/Fhg+1+4NfF415OpDuwpmaG5mHXfmsA0vI2kELGCg4=' 
WHERE 
  key_id = '0ced3206b308a048248ebc646b51bc8734829248c927eb62c5760b5e1fcd0dad' 
  AND (
    token = 'I/Fhg+1+4NfF415OpDuwpmaG5mHXfmsA0vI2kELGCg4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051