UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dDVl4QGQI+KaYW/OdAgfwSVXkVBu85XQFUqdh5ev5hw=' 
WHERE 
  key_id = '4dc7865242aa478c7bf0e95619b519e86b48898f7e19348b3c778d428a6e1f3a' 
  AND (
    token = 'dDVl4QGQI+KaYW/OdAgfwSVXkVBu85XQFUqdh5ev5hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020