UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N+W+PQ/r3vHWDACHZndw6JQHmezZvaAfu+KbZrNAGI4=' 
WHERE 
  key_id = '044fee3aca4c45db962f8abe5d924abc1b83cc76eaac8dedb81782cb1fc53319' 
  AND (
    token = 'N+W+PQ/r3vHWDACHZndw6JQHmezZvaAfu+KbZrNAGI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045