UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aqyyDVrbKVcyGh2Yk46mnmH6NAWuR7IAET03OiqWq+Q=' 
WHERE 
  key_id = 'b3c5a722d64fef4cc8e23e543eb2262f5771d0bd567ff2074e486ee287fb7ed1' 
  AND (
    token = 'aqyyDVrbKVcyGh2Yk46mnmH6NAWuR7IAET03OiqWq+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020