UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQ+vtJgDXBmcnN870/HoumTaoYHlVpE/sCP+X0YA52E=' 
WHERE 
  key_id = '2281a28bb75660809bee99da2a0348f17a3baf3f791b3dfade11fe451a44b647' 
  AND (
    token = 'KQ+vtJgDXBmcnN870/HoumTaoYHlVpE/sCP+X0YA52E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025