UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VNw+qodVDXynZ8poC0unBpZqHdm/AGaGlRzoHDvXse4=' 
WHERE 
  key_id = '99a7692caf8b58d23a83a8fe14c38dff14967cde9906d2f6d812432b3f898758' 
  AND (
    token = 'VNw+qodVDXynZ8poC0unBpZqHdm/AGaGlRzoHDvXse4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00075