UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3gF65iuVYwNFh1vqMFo/ZBNj3oK6VFWcXqORbXJGdJQ=' 
WHERE 
  key_id = '8c0130a95d4635453b397675f0893c56d372207375230e0b8d06c4558b722155' 
  AND (
    token = '3gF65iuVYwNFh1vqMFo/ZBNj3oK6VFWcXqORbXJGdJQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026