UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0LHhsT9Gn7zZ/Sy5X0PvOVRDD2m+RdjB36Hg8ywFxE=' 
WHERE 
  key_id = 'd2ab74d5e5486e1f19b05536b8a05dd197d2ef1f625bf11b06a0304ab4e270e4' 
  AND (
    token = 'O0LHhsT9Gn7zZ/Sy5X0PvOVRDD2m+RdjB36Hg8ywFxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032