UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R8Ideq+Pd3BrKU9hw3iY2cY96NQGqxq25gc3avQviuY=' 
WHERE 
  key_id = '757b4f343e96147cdd65b1d52e3321d13a29d99e03eaa44653e2f9ac7c7bfa0e' 
  AND (
    token = 'R8Ideq+Pd3BrKU9hw3iY2cY96NQGqxq25gc3avQviuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030