UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AaSElFkQzjWEJB/coy5I3Lxp/Ru7tKTvgOzs754Z5Oo=' 
WHERE 
  key_id = 'c5913d4cd21d1e127d010cda5912e04228ae90425ffd5e7fa4c4538afd4383d2' 
  AND (
    token = 'AaSElFkQzjWEJB/coy5I3Lxp/Ru7tKTvgOzs754Z5Oo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023