UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbKjI2wINt6V4egAkrWgwWS5Du6rJwua3SbkM8aUYQ4=' 
WHERE 
  key_id = '050751e680f2c43cbd0ac2db98a9e5110ce2db4a66635ce7c247c31af485ae93' 
  AND (
    token = 'dbKjI2wINt6V4egAkrWgwWS5Du6rJwua3SbkM8aUYQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035