UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gwxDmJFHSOOIBn22570cchL55cIBt+t00lTZ8Te5WBM=' 
WHERE 
  key_id = '23b881f038c993517968921a35a94bf9ccf0fb7d14935448ba1d3e8921c9e764' 
  AND (
    token = 'gwxDmJFHSOOIBn22570cchL55cIBt+t00lTZ8Te5WBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039