UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gdMj8s75fTO1phpaEAos0roIfb7IP/IqX2ptvUTSLiw=' 
WHERE 
  key_id = 'e4ab8b4a008da8a66fafe6748ddd4a1d80142cece5449b313dcd5c9ac8c8f856' 
  AND (
    token = 'gdMj8s75fTO1phpaEAos0roIfb7IP/IqX2ptvUTSLiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024