UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xo4oDBItzRBTt6zjot2p514KNQBmaT3Oz5M7eb/q4/U=' 
WHERE 
  key_id = '160a7fff185eef5c54c55623ebb6781eca710c449477143b3346281277211ed0' 
  AND (
    token = 'xo4oDBItzRBTt6zjot2p514KNQBmaT3Oz5M7eb/q4/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022