UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HtSZTyr3ip1cQWRQa3CDFHLufzd7EjZHz8ZMXP8ZEiE=' 
WHERE 
  key_id = '99822f7670ad139906e33dac3338671723997e14cd7181b720923fb12d5b3c2d' 
  AND (
    token = 'HtSZTyr3ip1cQWRQa3CDFHLufzd7EjZHz8ZMXP8ZEiE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027