UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LsCXN9OlMMR2UZvbcRwWz8bXyjjQdEWRa6ZnVjlIMOE=' 
WHERE 
  key_id = 'ddf820c39c868c88978d7077fc808cf7c192e575d3b8a41172784bd676b47fc5' 
  AND (
    token = 'LsCXN9OlMMR2UZvbcRwWz8bXyjjQdEWRa6ZnVjlIMOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018