UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U33zFCn3U3Ovo4eredL6I4UcxAiM+cYQ32U2CWB+QU4=' 
WHERE 
  key_id = 'd012b6953ece9d90017af6ca0c295547370f01d10a3577b1a53b7cb92b5adb84' 
  AND (
    token = 'U33zFCn3U3Ovo4eredL6I4UcxAiM+cYQ32U2CWB+QU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039