UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jwO6/1B9ssXcsKP3BQZMJ5iVCJCXhsYXnwyyarwFrBE=' 
WHERE 
  key_id = '7303a25e62643be93c4de6bd4586a200758873db844b03883ce606869a120fc9' 
  AND (
    token = 'jwO6/1B9ssXcsKP3BQZMJ5iVCJCXhsYXnwyyarwFrBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025