UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kKqDSGvx6ck2XYr3IufwFpUzTny00zvlDHN7srqopyo=' 
WHERE 
  key_id = '9044ec9a69c62f73b5bd3c7e224703a3d1b89680448211c0e6d06eed80865b78' 
  AND (
    token = 'kKqDSGvx6ck2XYr3IufwFpUzTny00zvlDHN7srqopyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046