UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qmjGS1UtDiXkUTzZVjZxJoA+1uNRbnPg2YnQWljANGw=' 
WHERE 
  key_id = 'd4846d675437a7554ccf9c74ee76829500f4766ba46097f6ab8cade69ad4aae2' 
  AND (
    token = 'qmjGS1UtDiXkUTzZVjZxJoA+1uNRbnPg2YnQWljANGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045