UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BhM1iU4UTDxfc45l+AhGY5k+Bs1hRbtTV8CB6BgHhwM=' 
WHERE 
  key_id = '5b961669b9dc11876e01734c34f2c17c9fa5ecd7aa25ca1dcbb633363ee32028' 
  AND (
    token = 'BhM1iU4UTDxfc45l+AhGY5k+Bs1hRbtTV8CB6BgHhwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032