UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mYCTshVGfXU+y3/cEaSZqbn2x2MtIj4r15Ee2qA3NtU=' 
WHERE 
  key_id = '39440f69be80d9ac20c81b83e70ba80882979d189efbb073ddab76883cd2cca5' 
  AND (
    token = 'mYCTshVGfXU+y3/cEaSZqbn2x2MtIj4r15Ee2qA3NtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033