UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BzrUe3tBUmx9xe6woBVSfXYChSUOgEnswiwrANolYGo=' 
WHERE 
  key_id = '7ba2dc8505ef8226952f69df0dad886c1e663dd0ac067d7a8af96bdc547dffa6' 
  AND (
    token = 'BzrUe3tBUmx9xe6woBVSfXYChSUOgEnswiwrANolYGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052