UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sfnJ4AUOf66dspi7WvjkX7P8EKMks1fD9Qo8TQyDcN0=' 
WHERE 
  key_id = '3c5288ee5d4f758b830b4e4a12e56a198a1b4f110dd6db4cdb9ad0aff323e905' 
  AND (
    token = 'sfnJ4AUOf66dspi7WvjkX7P8EKMks1fD9Qo8TQyDcN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023