UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QizlcbbI1m4q+y/cizgTNy2pKJnj60xso/OtY1T9ons=' 
WHERE 
  key_id = 'bb109a33b7a8a4cd8d379cd953dd7899ec669d35c61009a63d6583e3dc5338d6' 
  AND (
    token = 'QizlcbbI1m4q+y/cizgTNy2pKJnj60xso/OtY1T9ons=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048