UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gzJBht1VDoHYtNhdlOrNlWylfWKnQ+QZFmnI7LiWZVM=' 
WHERE 
  key_id = '3a4734f2f3cdb2e3f4bf1146ee9abb9b75fabd35b964486dbda4069a431d916c' 
  AND (
    token = 'gzJBht1VDoHYtNhdlOrNlWylfWKnQ+QZFmnI7LiWZVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036