UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PmZnNQp4BFEAtnNxu9S6LlElGl6f8TYZQVdGROONB+8=' 
WHERE 
  key_id = '4191cb36ce22a13a76054b87ee383279e97451687237461cdd1190a80f248e72' 
  AND (
    token = 'PmZnNQp4BFEAtnNxu9S6LlElGl6f8TYZQVdGROONB+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044