UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwHkFnWon+yBZH/CeZOXlUbYeD7XJZkskduC9nVMxvc=' 
WHERE 
  key_id = '5c40aff5f2c34147c81b46abd56cec52d9f0f857bbc486ef75072e6e5e6be788' 
  AND (
    token = 'AwHkFnWon+yBZH/CeZOXlUbYeD7XJZkskduC9nVMxvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046