UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DHU9zAKfh85vFfhHeA7X6HluRIoJItyGAEedmUWKi+w=' 
WHERE 
  key_id = 'bd84957254ae3acf986c78aad21e5620a8d0a210bd8a20b461de4761d26bc5b4' 
  AND (
    token = 'DHU9zAKfh85vFfhHeA7X6HluRIoJItyGAEedmUWKi+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034